home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / asmsrc / tangosources.lha / bobs_sources / bob.s
Text File  |  2008-06-03  |  7KB  |  274 lines

  1. *****************************************************************************
  2. *                    MINI 'NEW-GROUP' XENTRIX ARE LAUNCHED INTRO                *
  3. *                                                                            *
  4. *    CODE:      BY TANGO/XENTRIX                                                *
  5. *   STARTED:   9/2/91                                                        *
  6. *   FINISHED:  9/2/91                                                        *
  7. *                                                                            *
  8. *****************************************************************************
  9.  
  10.  
  11.     section ste,code_c
  12.     incdir    df1:
  13.     opt c-
  14.     include gamemacros
  15.  
  16.     
  17. *****************************************************************************
  18. *                        KILL O/S AND SET UP COPPER ETC...                    *
  19. *****************************************************************************
  20.  
  21.     killsys
  22.     move.l    #$70000,a0
  23.     move.l    #10240,d2
  24. cloop:
  25.     clr.l    (a0)+
  26.     dbf        d2,cloop
  27.  
  28.     move.l    #$60000,a0
  29.     move.l    #10240,d2
  30. dloop:
  31.     clr.l    (a0)+
  32.     dbf        d2,dloop
  33.     
  34.     lea        custom,a5
  35.     move.l    #newcop,$dff080
  36.     move.w    #$8640,$dff096
  37. mouse:
  38.     move.l    vposr(a5),d0            
  39.     and.l    #$1ff00,d0
  40.     cmp.l    #$00100,d0    
  41.     bne.s    mouse
  42. ;    move.w    #$fff,$dff180
  43.  
  44.     bsr        dbuff
  45.     bsr        clear_bobs
  46.     bsr        move_bobs
  47.  
  48.     move.w    #$000,$dff180
  49.     btst    #6,$bfe001
  50.     bne.s    mouse
  51.     ressys
  52.     clr.l    d0
  53.     rts
  54.  
  55.  
  56. *****************************************************************************
  57. *                                BLIT BOB ON                                    *
  58. *****************************************************************************
  59.  
  60. blit_bob:
  61.     lea        bltapth(a5),a3                ; Faster addressing modes
  62.     lea        bltbpth(a5),a4
  63.     lea        bltdpth(a5),a6
  64.     move.w    #36,d7
  65.     move.w    #-2,d3
  66.     move.w    #48<<6!2,d4
  67.     move.l    bob_y(pc),d0                ; get ship y-pos in d0
  68.     move.l    bob_x(pc),d1                ; get ship x-pos in d1
  69.     move.l    screen_base(pc),a0            ; screen addr.
  70.     lea        bobs(pc),a1                    ; bob gfx
  71.     lea        bobmask(pc),a2                ; bob mask gfx
  72.     move.w    #$0fca,d6                    ; minterm for cookie cut
  73.     ror.l    #4,d1                        ; divide x-pos by 16
  74.     add.w    d1,d1                        ; times by 2 (keep in words!)
  75.     add.w    d1,d0                        ; add x-pos to y-pos
  76.     add.l    d0,a0                        ; add to screen addr.
  77.     swap    d1                            ; swap hi and lo words
  78.     or.w    d1,d6                        ; 'OR' with minterm (get shift value)
  79.     blitwait
  80.     move.w    d3,bltamod(a5)                ; modulo =-2 (using RAW BLIT)
  81.     move.w    d3,bltbmod(a5)                ; modulo =-2 (using RAW BLIT)
  82.     move.w    d7,bltcmod(a5)            
  83.     move.w    d7,bltdmod(a5)
  84.     move.l    a0,bltcpth(a5)                ; screen addr. in Source C
  85.     move.l    a0,(a6)                        ; bltdpth Screen addr. in Dest D
  86.     move.l    a1,(a4)                        ; bltbpth Ship gfx addr. in Source B
  87.     move.l    a2,(a3)                        ; bltapth Ship mask gfx addr. in Source A
  88.     move.w    #$ffff,bltafwm(a5)
  89.     move.w    #$0000,bltalwm(a5)
  90.     move.w    d6,bltcon0(a5)                ; Shift value
  91.     move.w    d1,bltcon1(a5)                ; Shift value for mask
  92.     move.w    d4,bltsize(a5)                ; Go to work !
  93.     rts
  94.  
  95.  
  96. *****************************************************************************
  97. *                                MOVE THE BOBS                                *
  98. *****************************************************************************
  99.  
  100. move_bobs:
  101.     lea        ysintab(pc),a1        ; point to y-sine table
  102.     lea        xsintab(pc),a2        ; point to x-sine table
  103.     move.l    frmptr(pc),a0        ; pointer to formation
  104.     move.w    (a0)+,d7            ; no. of bobs to plot
  105. bob_loop:
  106.     move.w    (a0)+,d1            ; x-pos
  107.     move.w    (a0)+,d0            ; y-pos
  108.     move.w    (a0)+,d5            ; x-increment
  109.     move.w    (a0)+,d6            ; y-increment
  110.     add.w    d0,d0                ; to even words
  111.     add.w    d1,d1                ; to even words
  112.     and.w    #$fe,d0                
  113.     and.w    #$fe,d1
  114.     move.w    (a1,d0),bob_y+2        ; got y-pos relevant to sine table
  115.     move.w    (a2,d1),bob_x+2        ; got x-pos relevant to sine table
  116.     save_all
  117.     bsr        blit_bob
  118.     return_all
  119.         add.w    d5,-8(a0)        ; add to x-pos                
  120.         add.w    d6,-6(a0)        ; add to y-pos
  121.         dbf        d7,bob_loop
  122.     rts
  123.  
  124.  
  125. *****************************************************************************
  126. *                            DOUBLE BUFFER THE SCREEN                        *
  127. *****************************************************************************
  128.  
  129. dbuff:
  130.     not.b    buffer                        ; logical not
  131.     tst.b    buffer                        ; test which screen
  132.     bne.s    other                        ; if not, then flip
  133.     move.l    #$60000,screen_base            ; point screen to $60000
  134.     move.w    #$0006,a1h+2                ; set up bitmaps
  135.     move.w    #$0006,a2h+2    
  136.     move.w    #$0006,a3h+2    
  137.     rts
  138. other:                
  139.     move.l    #$70000,screen_base            ; point screen to $70000
  140.     move.w    #$0007,a1h+2                ; set up bitmaps
  141.     move.w    #$0007,a2h+2    
  142.     move.w    #$0007,a3h+2    
  143.     rts
  144.  
  145.  
  146. clear_bobs:
  147.  
  148.     move.l    screen_base(pc),a0
  149.     blitwait
  150.     move.w    #$0000,bltdmod(a5)
  151.     move.l    #-1,bltafwm(a5)
  152.     move.l    #$01000000,bltcon0(a5)
  153.     move.l    a0,bltdpth(a5)
  154.     move.w    #216*64+60,bltsize(a5)
  155.     rts
  156.  
  157.     
  158. *****************************************************************************
  159. *                            INTRO COPPER LIST                                *
  160. *****************************************************************************
  161.  
  162. newcop:
  163.     cmove    bpl1mod,80
  164.     cmove    bpl2mod,80    
  165.     cmove    bplcon0,$3200
  166.     cmove    diwstrt,$2c81
  167.     cmove    diwstop,$2cc1
  168.     cmove    ddfstrt,$38
  169.     cmove    ddfstop,$d0
  170. a1h    cmove    bpl1pth,$0007
  171.     cmove    bpl1ptl,$0000
  172. a2h    cmove    bpl2pth,$0007
  173.     cmove    bpl2ptl,$0028
  174. a3h    cmove    bpl3pth,$0007
  175.     cmove    bpl3ptl,$0050
  176.     dc.w    $0180,$0000,$0182,$0eee,$0184,$0555,$0186,$0666
  177.     dc.w    $0188,$08aa,$018a,$0499,$018c,$03bb,$018e,$00dd
  178.     end_copper
  179.  
  180.  
  181. *****************************************************************************
  182. *                                INTRO VARIABLES                                *
  183. *****************************************************************************
  184.  
  185. screen_base:
  186.     dc.l    $70000
  187. bob_y:
  188.     dc.l    20
  189. bob_x:
  190.     dc.l    20
  191. frmptr:
  192.     dc.l    form1
  193. buffer:
  194.     dc.b    0
  195.     even
  196.     
  197.     
  198. *****************************************************************************
  199. *                                BOB FORMATION DATA                            *
  200. *****************************************************************************
  201.  
  202. form1:
  203.     dc.w    30-1
  204. x    set    0
  205. y    set    0
  206.     rept    30
  207.     dc.w    x,y
  208.     dc.w    1,1
  209. x    set        x+20
  210. y    set        y-40
  211.     endr
  212.     even    
  213.  
  214.  
  215. *****************************************************************************
  216. *                            X,Y SINETABLES FOR BOBS                            *
  217. *****************************************************************************
  218.  
  219. ysintab:
  220.     rept    2
  221.     dc.w    200*120,200*120,200*120,199*120,198*120,197*120,196*120,194*120
  222.     dc.w    192*120,190*120,188*120,186*120,183*120,180*120,177*120,174*120
  223.     dc.w    171*120,167*120,163*120,160*120,156*120,151*120,147*120,143*120
  224.     dc.w    138*120,134*120,129*120,124*120,120*120,115*120,110*120,105*120
  225.     dc.w    100*120,95*120,90*120,85*120,80*120,76*120,71*120,66*120
  226.     dc.w    62*120,57*120,53*120,49*120,44*120,40*120,37*120,33*120
  227.     dc.w    29*120,26*120,23*120,20*120,17*120,14*120,12*120,10*120
  228.     dc.w    8*120,6*120,4*120,3*120,2*120,1*120,0*120,0*120
  229.     dc.w    0*120,0*120,0*120,1*120,2*120,3*120,4*120,6*120
  230.     dc.w    8*120,10*120,12*120,14*120,17*120,20*120,23*120,26*120
  231.     dc.w    29*120,33*120,37*120,40*120,44*120,49*120,53*120,57*120
  232.     dc.w    62*120,66*120,71*120,76*120,80*120,85*120,90*120,95*120
  233.     dc.w    100*120,105*120,110*120,115*120,120*120,124*120,129*120,134*120
  234.     dc.w    138*120,143*120,147*120,151*120,156*120,160*120,163*120,167*120
  235.     dc.w    171*120,174*120,177*120,180*120,183*120,186*120,188*120,190*120
  236.     dc.w    192*120,194*120,196*120,197*120,198*120,199*120,200*120,200*120
  237.     endr
  238.     even
  239. xsintab:
  240.     rept    2
  241.     dc.w    280,280,279,278,277,276,274,272
  242.     dc.w    269,267,263,260,256,252,248,244
  243.     dc.w    239,234,229,223,218,212,206,200
  244.     dc.w    194,187,181,174,167,161,154,147
  245.     dc.w    140,133,126,119,113,106,99,93
  246.     dc.w    86,80,74,68,62,57,51,46
  247.     dc.w    41,36,32,28,24,20,17,13
  248.     dc.w    11,8,6,4,3,2,1,0
  249.     dc.w    0,0,1,2,3,4,6,8
  250.     dc.w    11,13,17,20,24,28,32,36
  251.     dc.w    41,46,51,57,62,68,74,80
  252.     dc.w    86,93,99,106,113,119,126,133
  253.     dc.w    140,147,154,161,167,174,181,187
  254.     dc.w    194,200,206,212,218,223,229,234
  255.     dc.w    239,244,248,252,256,260,263,267
  256.     dc.w    269,272,274,276,277,278,279,280
  257.     endr
  258.     even
  259.     
  260.  
  261. *****************************************************************************
  262. *                                BINARY FILES                                *
  263. *****************************************************************************
  264.  
  265. bobs:
  266.     incbin    gfx/ball.bin
  267. bobmask:
  268.     incbin    gfx/ballmask
  269.     even
  270.  
  271.  
  272.  
  273.     
  274.